import request from '@/utils/request'

/**
 * 材料列表
 * @param {*} query 
 * @returns 
 */
export function listMeterials(query) {
  return request({
    url: '/exam/learnMeterial/list',
    method: 'get',
    params: query
  })
}

/**
 * 材料新增
 * @param {materialName,materialCategory,attachId,duration,brief} data 
 * @returns 
 */
export function addMeterial(data) {
  return request({
    url: '/exam/learnMeterial',
    method: 'post',
    data: data
  })
}

/**
 * 材料删除
 * @param {materialId} materialId 
 * @returns 
 */
export function MaterialDelete(materialId) {
  return request({
    url: '/exam/learnMeterial/' + materialId,
    method: 'delete',
  })
}

/**
 * 材料修改
 * @param {*} data 
 * @returns 
 */
export function editMeterial(data) {
  return request({
    url: '/exam/learnMeterial',
    method: 'put',
    data: data
  })
}

/**
 * 材料附件查询
 * @param {attachIds} attachIds 
 * @returns 
 */
export function getMeterials(attachIds) {
  return request({
    url: '/com/ComAttach/selectManyAttach',
    method: 'post',
    data: attachIds
  })
}

/**
 * 根据小组id查询材料列表
 * @param {*} query 
 * @returns 
 */
export function selectMaterialsByGroupId(groupId, query) {
  return request({
    url: '/exam/learnMeterial/selectMaterialsByGroupId/' + groupId,
    method: 'get',
    params: query
  })
}

/**
 * 根据小组id查询未添加的材料列表
 * @param {*} query 
 * @returns 
 */
export function selectMaterialsByGroupIdNotIn(groupId, query) {
  return request({
    url: '/exam/learnMeterial/selectMaterialsByGroupIdNotIn/' + groupId,
    method: 'get',
    params: query
  })
}